package com.ycz.springcloud.controller;/*
 @author ycz
 @date 2021-08-19-16:43  
*/

import org.springframework.stereotype.Controller;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

/**
 * 专门跳转的页面
 */
@Controller
@RequestMapping("/page")
public class PageController {
    @GetMapping("/main.do")
    public String toMain(Model model,HttpSession session){

        model.addAttribute("loginName",session.getAttribute("loginName"));
        return "main";
    }

    /**
     * 退出
     * @return
     */
    @GetMapping("/logout.do")
    public String logout(HttpSession session){
        //取消session
        session.removeAttribute("loginName");
        //取消角色
        session.removeAttribute("role");
        return "index";
    }

    /**
     * 跳转到用户的list页面
     * @return
     */
    @GetMapping("/user/list.do")
    public String toUserList(){
        return "view/user/list";
    }

    @GetMapping("/customer/list.do")
    public String toCustomer(){
        return "view/customer/list";
    }


}
